package com.kgc.ubatnet.ubatnetuserservice.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kgc.ubatnet.bean.PmsProductInfo;
import com.kgc.ubatnet.bean.PmsProductInfoExample;
import com.kgc.ubatnet.bean.PmsProductSaleAttr;
import com.kgc.ubatnet.service.SpuService;
import com.kgc.ubatnet.ubatnetuserservice.mapper.PmsProductInfoMapper;
import com.kgc.ubatnet.ubatnetuserservice.mapper.PmsProductSaleAttrMapper;
import org.apache.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author shkstart
 * @create 2020-09-22 12:08
 */
@Service
public class SpuServiceImpl implements SpuService {

    @Resource
    PmsProductInfoMapper pmsProductInfoMapper;

    @Resource
    PmsProductSaleAttrMapper pmsProductSaleAttrMapper;

    @Override
    public List<PmsProductSaleAttr> spuSaleAttrListIsCheck(Long spuId, Long skuId) {
        List<PmsProductSaleAttr> pmsProductSaleAttrs = pmsProductSaleAttrMapper.spuSaleAttrListIsCheck(spuId, skuId);
        return pmsProductSaleAttrs;
    }

    @Override
    public String selespuByCata3(Long cata3,Integer pageNum) {
        PmsProductInfoExample example=new PmsProductInfoExample();
        example.createCriteria().andCatalog3IdEqualTo(cata3);
        PageHelper.startPage(pageNum,5);
        List<PmsProductInfo> pmsProductInfos = pmsProductInfoMapper.selectByExample(example);
        PageInfo<PmsProductInfo> pageInfo=new PageInfo<>(pmsProductInfos);

        return null;
    }
}
